import GlobalConstant from "@/domain/constants/GlobalConstant";

class LocalStorageUtils {

    // token存储
    getToken() {
        return localStorage.getItem(GlobalConstant.TOKEN_KEY)
    }

    setToken(token: string) {
        return localStorage.setItem(GlobalConstant.TOKEN_KEY, token)
    }

    removeToken() {
        return localStorage.removeItem(GlobalConstant.TOKEN_KEY)
    }

    // password存储
    getPassWord() {
        return localStorage.getItem(GlobalConstant.PWD_KEY)
    }

    setPassWord(passWord: string) {
        return localStorage.setItem(GlobalConstant.PWD_KEY, passWord)
    }

    removePassWord() {
        return localStorage.removeItem(GlobalConstant.PWD_KEY)
    }

    // userName存储
    getUserName() {
        return localStorage.getItem(GlobalConstant.USER_NAME_KEY)
    }

    setUserName(userName: string) {
        return localStorage.setItem(GlobalConstant.USER_NAME_KEY, userName)
    }

    removeUserName() {
        return localStorage.removeItem(GlobalConstant.USER_NAME_KEY)
    }

}
export let localStorageUtils = new LocalStorageUtils();